package com.bc.bcapi.service;

import com.bc.bcapi.dao.StatisticsMapper;
import com.bc.bcmodel.req.StatisticsReq;
import com.bc.bcmodel.resp.MngOrderListResp;
import com.bc.bcmodel.resp.StatisticsListOrderResp;
import com.bc.bcmodel.resp.StatisticsListRechargeResp;
import com.bc.bcmodel.resp.StatisticsListWithdrawResp;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Name StatisticsService
 * @Description TODO
 * @Author douhaichao
 * @Date 2018/9/26 14:56
 * @Version 1.0
 **/
@Service
public class StatisticsService {
    @Resource
    StatisticsMapper statisticsMapper;

    public PageInfo<StatisticsListRechargeResp> getRechargeList(StatisticsReq req) {
        PageHelper.startPage(req.getPage_index(), req.getPage_size());
        List<StatisticsListRechargeResp> list = statisticsMapper.getRechargeList(req);
        return new PageInfo<StatisticsListRechargeResp>(list);
    }

    public PageInfo<StatisticsListOrderResp> getOrderList(StatisticsReq req) {
        PageHelper.startPage(req.getPage_index(), req.getPage_size());
        List<StatisticsListOrderResp> list = statisticsMapper.getOrderList(req);
        return new PageInfo<StatisticsListOrderResp>(list);
    }

    public PageInfo<StatisticsListWithdrawResp> getWithdrawList(StatisticsReq req) {
        PageHelper.startPage(req.getPage_index(), req.getPage_size());
        List<StatisticsListWithdrawResp> list = statisticsMapper.getWithdrawList(req);
        return new PageInfo<StatisticsListWithdrawResp>(list);
    }

    /**
     * 获取充值总金额
     */
    public StatisticsListRechargeResp getTotalRechargeList(StatisticsReq req) {
        return statisticsMapper.getTotalRechargeList(req);
    }
    /**
     * 获取订单总金额
     */
    public StatisticsListOrderResp getTotalOrderList(StatisticsReq req) {
        return statisticsMapper.getTotalOrderList(req);
    }

    /**
     * 获取提现总金额
     * */
    public StatisticsListWithdrawResp getTotalWithdrawList(StatisticsReq req) {
        return statisticsMapper.getTotalWithdrawList(req);
    }
}
